Socket
Socket
Sign inDemoInstall

@tiptap/extension-horizontal-rule

Package Overview
Dependencies
Maintainers
5
Versions
164
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/extension-horizontal-rule

horizontal rule extension for tiptap


Version published
Maintainers
5
Created

What is @tiptap/extension-horizontal-rule?

@tiptap/extension-horizontal-rule is an extension for the Tiptap editor that allows users to insert horizontal rules (also known as horizontal lines) into their rich text content. This can be useful for visually separating sections of content.

What are @tiptap/extension-horizontal-rule's main functionalities?

Insert Horizontal Rule

This feature allows you to insert a horizontal rule into the editor. The code sample demonstrates how to import the HorizontalRule extension, initialize the Tiptap editor with it, and programmatically insert a horizontal rule.

import { HorizontalRule } from '@tiptap/extension-horizontal-rule';
import { Editor } from '@tiptap/core';

const editor = new Editor({
  extensions: [
    HorizontalRule,
  ],
});

// To insert a horizontal rule programmatically
editor.chain().focus().setHorizontalRule().run();

Custom Styling for Horizontal Rule

This feature allows you to customize the styling of the horizontal rule. The code sample demonstrates how to extend the HorizontalRule extension to add a custom class to the horizontal rule element, and then initialize the Tiptap editor with this customized extension.

import { HorizontalRule } from '@tiptap/extension-horizontal-rule';
import { Editor } from '@tiptap/core';

const CustomHorizontalRule = HorizontalRule.extend({
  renderHTML({ HTMLAttributes }) {
    return ['hr', { class: 'custom-horizontal-rule', ...HTMLAttributes }];
  },
});

const editor = new Editor({
  extensions: [
    CustomHorizontalRule,
  ],
});

Other packages similar to @tiptap/extension-horizontal-rule

Keywords

FAQs

Package last updated on 23 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc